import request from '@/plugins/request'
import { IResponseData } from '@/types/request-base'
import { json2FormData } from '@/utils'

// 经销商终止合作接口

const TYPE_VALUE = 'I'

/**
 * 合作终止详情
 * @param {string} ID
 */
export function detail(id: string) {
  return request<IResponseData>({
    method: 'get',
    url: `/app/v1/ctmCustomerChange/detail/cooperationEnd/${id}`,
    loading: true
  })
}

/**
 * 保存或提交-经销商合作终止
 * @param {string} ID
 */
export function saveCooperationEnd(data: Object) {
  return request<IResponseData>({
    method: 'POST',
    url: `/app/v1/ctmCustomerChange/createOrSubmit/cooperationEnd`,
    data: {
      type: TYPE_VALUE,
      ...data
    },
    loading: true
  })
}
